/**
 * 角色信息数维护页面JS
 * User: zhaoming
 * Date: 15-8-17
 * Time: 下午5:58
 * To change this template use File | Settings | File Templates.
 */
$(function(){
    //激活左侧导航菜单
    activeNavBar("AUTHORITY_ROLE_INFO", "AUTHORITY");

    $("#save").click(function(){
        save();
    });

    $("#goBack").click(function(){
        window.location.href = "/web/roleInfo/index";
    });
});

/**
 * 保存
 */
function save(){

    if($('#roleForm').trigger("validate").isValid()){
        Loading.show();
        jQuery.ajax({
            type: "POST",
            dataType: "json",
            url: springUrl+"/web/roleInfo/updateByPrimaryKey",
            data: {
                id: $('#id').val(),
                roleCode: $('#roleCode').val(),
                roleName : $('#roleName').val(),
                remark : $('#remark').val()
            },
            success: function (data) {
                Loading.hide();
                Commons.showSuccess("数据保存成功!", function(){
                    window.location.href = "/web/roleInfo/index";
                });
            },
            error: function(data){
                Loading.hide();
                Commons.showError("数据保存失败!");
            }
        });
    }

}

